package org.mzyyn.qr.controller;

import org.mzyyn.qr.constants.AppletsApiUrlMapping;
import org.mzyyn.qr.dto.assistance.AssistanceSuccessDTO;
import org.mzyyn.qr.dto.goods.GoodsInfoDTO;
import org.mzyyn.qr.dto.goods.PageQueryDTO;
import org.mzyyn.qr.service.auction.AuctionGoodsService;
import org.mzyyn.qr.vo.goods.GoodsInfoVO;
import org.qr.xiaocao.common.entity.BaseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 拍卖商品表 前端控制器
 * </p>
 *
 * @author lipeng
 * @since 2024-09-23
 */
@RestController
@RequestMapping("/applets/auction/goods")
public class AuctionGoodsController {

    @Autowired
    private AuctionGoodsService auctionGoodsService;

    /**
     * 商品列表
     * @return
     */
    @PostMapping("/list")
    public BaseResult list(
            @RequestBody @Validated PageQueryDTO pageQueryDTO
    ){
        return BaseResult.ok(auctionGoodsService.pageList(pageQueryDTO));
    }

    /**
     * 商品列表
     * @return
     */
    @PostMapping("/info")
    public BaseResult<GoodsInfoVO> info(
            @RequestBody @Validated GoodsInfoDTO goodsInfoDTO
    ){
        return BaseResult.ok(auctionGoodsService.goodsInfo(goodsInfoDTO));
    }
}
